import MapDialog from '../components/wf-map-dialog';
//打开位置
const openMap =(lng,lat,addr) =>{
    var dlg=new window.top.Dialog();//定义Dialog对象
    dlg.Model=true;
    dlg.Width=900;//定义长度
    dlg.Height=600;
    dlg.URL="/systeminfo/BrowserMain.jsp?url=" + escape("/workflow/ruleDesign/showLocateOnline.jsp?useType=2&lng=" + lng +"&lat=" + lat + "&addr=" + encodeURI(addr) );
    dlg.Title='查看位置';
    dlg.callback=function(data){}
    dlg.show();
}

const openlocation = (positionStr='', dialogLayout=window.document.body) => {
  let obj = null;
  if(!document.getElementById('map-dialog')) {
    obj = document.createElement('div');
    obj.setAttribute('id', 'map-dialog');
    document.body.appendChild(obj);
  } else {
    obj = document.getElementById('map-dialog');
  }
  ReactDOM.render( <MapDialog ecId={`${this && this.props && this.props.ecId || ''}_MapDialog@k5v12x`} setLayout={dialogLayout} location={positionStr}/>,obj);
}
window.openMap = openMap;
window.openlocation = openlocation;